import request from '@/config/axios'

/** API类型信息 */
export interface ApiTypeInfo {
          id: number; // ID
          name?: string; // API名称
          price?: number; // API单次调用价格
  }

// API类型 API
export const ApiTypeInfoApi = {
  // 查询API类型分页
  getApiTypeInfoPage: async (params: any) => {
    return await request.get({ url: `/business/api-type-info/page`, params })
  },

  // 查询API类型详情
  getApiTypeInfoAll: async (type: number) => {
    return await request.get({ url: `/business/api-type-info/all?type=` + type })
  },

  // 查询API类型详情
  getApiTypeInfo: async (id: number) => {
    return await request.get({ url: `/business/api-type-info/get?id=` + id })
  },

  // 查询API类型详情
  getApiByCode: async (code: string) => {
    return await request.get({ url: `/business/api-type-info/get/` + code })
  },

  // 获取智能审核API价格
  getApiZnshPrice: async () => {
    return await request.get({ url: `/business/api-type-info/get/znsh/price` })
  },

  // 新增API类型
  createApiTypeInfo: async (data: ApiTypeInfo) => {
    return await request.post({ url: `/business/api-type-info/create`, data })
  },

  // 修改API类型
  updateApiTypeInfo: async (data: ApiTypeInfo) => {
    return await request.put({ url: `/business/api-type-info/update`, data })
  },

  // 修改API类型
  updateStatus: async (data: any) => {
    return await request.put({ url: `/business/api-type-info/update/status`, data })
  },

  // 删除API类型
  deleteApiTypeInfo: async (id: number) => {
    return await request.delete({ url: `/business/api-type-info/delete?id=` + id })
  },

  /** 批量删除API类型 */
  deleteApiTypeInfoList: async (ids: number[]) => {
    return await request.delete({ url: `/business/api-type-info/delete-list?ids=${ids.join(',')}` })
  },

  // 导出API类型 Excel
  exportApiTypeInfo: async (params) => {
    return await request.download({ url: `/business/api-type-info/export-excel`, params })
  },
}
